#include "StdAfx.h"
#include "MsgShow.h"
#include "WaitingShowDlg.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#endif

CMsgShow::CMsgShow(void)
: m_pDlg( NULL )
{
}

CMsgShow::~CMsgShow(void)
{
	if ( m_pDlg )
	{
		m_pDlg->DestroyWindow();
		delete m_pDlg;
		m_pDlg = NULL;
	}
}

void CMsgShow::ShowMessageBox( EMessageType )
{
	if ( !m_pDlg )
	{
		CWnd* pParent = AfxGetApp()->GetMainWnd();
		m_pDlg = new CWaitingShowDlg;
		m_pDlg->Create( CWaitingShowDlg::IDD, pParent );
	}
	m_pDlg->ShowWindow( SW_SHOW );
	m_pDlg->UpdateWindow();
	Sleep( 1000 );
}
void CMsgShow::HideMessageBox( EMessageType )
{
	if ( m_pDlg )
	{
		m_pDlg->ShowWindow( SW_HIDE );
		if ( m_pDlg->GetParent() == NULL )
		{
			m_pDlg->DestroyWindow();
			delete m_pDlg;
			m_pDlg = NULL;
		}
	}
}

